<template>
  <div class="product-card">
    <div class="product-image">
      <img :src="product.image" :alt="product.name" />
    </div>
    <div class="product-info">
      <div class="product-name">{{ product.name }}</div>
      <div class="price-label">最高回收价</div>
      <div class="price-action-row">
        <div class="price">¥{{ product.price }}</div>
        <button class="recycle-btn" @click="handleRecycle">
          立即回收
        </button>
      </div>
    </div>
    <div class="product-actions">
      <div class="discount-tag"></div>
    </div>
  </div>
</template>

<script>
export default {
  name: 'ProductCard',
  props: {
    product: {
      type: Object,
      required: true,
      default: () => ({
        id: '',
        name: '',
        price: '0',
        image: '',
        brandName: '',
        categoryName: ''
      })
    }
  },
  methods: {
    handleRecycle() {
      this.$emit('recycle', this.product)
    }
  }
}
</script>

<style scoped>
.product-card {
  width: 686rpx;
  height: 218rpx;
  border-radius: 24rpx;
  margin-top: 32rpx;
  display: flex;
  align-items: center;
  padding: 16rpx;
  background: #FFF6D3;
  position: relative;
}

.product-image {
  width: 186rpx;
  height: 186rpx;
  margin-right: 16px;
  border-radius: 8px;
  overflow: hidden;
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
}

.product-image img {
  width: 150rpx;
  height: 150rpx;
  object-fit: cover;
}

.product-info {
  flex: 1;
}

.product-name {
  font-size: 16px;
  font-weight: 600;
  color: #333;
  margin-bottom: 4px;
}

.price-label {
  font-size: 12px;
  color: #999;
  margin-bottom: 4px;
}

.price-action-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 8px;
  width: 100%;
}

.price {
  font-size: 20px;
  font-weight: bold;
  color: #333;
}

.product-actions {
  position: absolute;
  right: 0;
  top: 0;
  width: auto;
}

.discount-tag {
  background:url("https://chushouya.oss-cn-shenzhen.aliyuncs.com/assets/images/special/tip.png") no-repeat center center;
  width: 78rpx;
  height: 82rpx;
  position: absolute;
  right: 20rpx;
  top: -10rpx;
  background-size: 78rpx 82rpx;
}

.recycle-btn {
  width: 192rpx;
  height: 80rpx;
  line-height: 80rpx;
  background: #FFCD00;
  border-radius: 40rpx;
  text-align: center;
  font-weight: 600;
  font-size: 28rpx;
  color: #333333;
  border: none;
  cursor: pointer;
}

.recycle-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(255, 165, 0, 0.3);
}
</style>
